package com.foreknow.demo5Exercise1;

/**
 * 5.1定义一个人类Person：
 * 5.1.1定义一个方法sayHello()，可以向对方发出问候语“hello,my name is XXX”
 * 5.1.2有三个属性：名字、身高、体重
 * 5.1.3通过构造方法，分别给三个属性赋值
 */
public class Person {

    public static void sayHello() {
        System.out.println("hello,my name is XiaoWang！");
    }

    private String name;
    private double height;
    private double weight;

    public Person(String name,double height,double weight) {
        this.name = name;
        this.height = height;
        this.weight = weight;
    }

    public static void main(String[] args) {
        Person person = new Person("XiaoWang",179.5,130);
        person.sayHello();
        System.out.println("名字为：" + person.name);
        System.out.println("身高为：" + person.height);
        System.out.println("体重为：" + person.weight);

    }

}






